#ifndef PLAYLIST_H
#define PLAYLIST_H

#include <QtCore>
#include <QtXML>
#include <vector>
using namespace std;

class Playlist : public QObject
{
	Q_OBJECT

public :
	Playlist();
	~Playlist();

	void loadPlaylist(QString);
	void savePlaylist(QString);

	void reset(void);
	void setIndex(int);
	void movIndex(int);

	void addItem(QString);
	void delItem(int);
	void setItemPoses(unsigned int *, QString);
	void setItemTags(QString, QString, QString);

	int  sumItems(void);
	bool isEmpty(void);
	bool isEndOfList(void);

	QString itemPath(int);
	QString itemPath(void);
	QString itemTag(int, int);
	int     itemType(int);
	int     itemPos(int);

public slots :
	void whileItemFinished(void);

signals :
	void itemFinished(void);
	void itemLoaded(QString);
	//void debuginfo(QString);

private :
	struct theitem {
		QString filepath;
		QString filename;
		QString title;
		QString artist;
		QString album;
		unsigned int pos[14];
	};

	vector<theitem> items;

	bool isSaved;
	bool empty;
	bool endoflist;
	int sum;
	int index;
	int played;

	QString playlistPath;
};

#endif
